package practice;

import java.time.LocalDate;

public class DepositAccount extends BankAccount {
    private long holdMonths = 1;
    private LocalDate lastIncome = LocalDate.now();

    @Override
    public void put(double amountToPut) {
        lastIncome = LocalDate.now();

        super.put(amountToPut);
    }

    @Override
    public void take(double amountToTake) {
        if (lastIncome.plusMonths(holdMonths).isBefore(LocalDate.now())) {
            super.take(amountToTake);
        }
    }
}
